﻿using System.ComponentModel.DataAnnotations;
using FlyingHat.Model.Enums;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;

namespace FlyingHat.Office.Import
{
    /// <summary>
    /// 学生用户导入
    /// </summary>
    [ExcelImporter(IsLabelingError = true)]
    public class Student
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [ImporterHeader(Name = "学号", IsAllowRepeat = false)]
        [Required(ErrorMessage = "学号不能为空")]
        [MaxLength(50, ErrorMessage = "学号字数超出最大限制,请修改!")]
        public string UserName { get; set; } = string.Empty;

        /// <summary>
        /// 姓名
        /// </summary>
        [ImporterHeader(Name = "姓名")]
        [Required(ErrorMessage = "学生姓名不能为空")]
        [MaxLength(50, ErrorMessage = "姓名字数超出最大限制,请修改!")]
        public string RealName { get; set; } = string.Empty;

        /// <summary>
        /// 手机号
        /// </summary>
        [ImporterHeader(Name = "手机号", IsAllowRepeat = false)]
        [Required(ErrorMessage = "手机号不能为空")]
        [MaxLength(11, ErrorMessage = "手机号字数超出最大限制,请修改!")]
        public string Phone { get; set; } = string.Empty;

        /// <summary>
        /// 性别
        /// </summary>
        [ValueMapping("男", 0)]
        [ValueMapping("女", 1)]
        [ImporterHeader(Name = "性别")]
        [Required(ErrorMessage = "性别不能为空")]
        public Gender Gender { get; set; }
    }
}
